/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 combat_footprint.h

	$Header: /heroes4/combat_footprint.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( COMBAT_FOOTPRINT_H_INCLUDED )
#define COMBAT_FOOTPRINT_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>

struct t_map_point_2d;

// -------------------------------------------------------------------------
// footprint of combat object, marked by cell as to whether a cell is used.
// -------------------------------------------------------------------------
class t_combat_footprint
{
public:
	t_combat_footprint( int size ); // creates a circular footprint of a given size
	// creates a footprint defining intersection of two footprints
	t_combat_footprint( t_combat_footprint const& fixed_footprint, 
		                t_combat_footprint const& moving_footprint ); 
	int get_size() const;

	int const* get() const;
	bool        overlaps( t_map_point_2d const& point,
					      t_combat_footprint const& right ) const;
	int const* operator[]( int row ) const;
protected:
	t_combat_footprint();

	int               m_size;
	std::vector<int> m_marked;
};

inline int t_combat_footprint::get_size() const
{
	return m_size;
}

inline int const* t_combat_footprint::get() const
{
	// return &(*m_marked.begin());
  return ((m_marked.size() > 0) ? &(*m_marked.begin()) : NULL);

}

inline int const* t_combat_footprint::operator []( int row ) const
{
	return &m_marked.at(row * m_size);
}

t_combat_footprint const& get_combat_footprint( int size );
t_combat_footprint const& get_footprint_overlap( int fixed_size, int moving_size );

#endif // COMBAT_FOOTPRINT_H_INCLUDED